define(["app/js/PDFViewer", './PDFDocDataMock'], 
  function(PDFViewer, PDFDocData){
describe('console html content', function() {

  beforeEach(function() {
    jasmine.getFixtures().fixturesPath = 'base/view/';
    loadFixtures("index.html");      
  });  

  beforeEach(function(){
    jasmine.Ajax.requests.when = function (url) {
      return this.filter(url)[0];
    };
     jasmine.Ajax.install();
  });

  afterEach(function() {
      jasmine.Ajax.uninstall()
  })
  it('index html', function() {
    expect($("h2")).toBeInDOM();
    expect($("h2")).toContainText("this is index page");
  });  

  it('docViewer', function(done) {
   var settings = {
        s3Key: 'doc_1'
    };
    var pdfApi = $("#docViewer").pdfViewer(settings).data("jsp");
   
    jasmine.Ajax.requests.when("/pdfdata/doc_1/PagesInfo_form").response({
      "status": 200,
      "contentType": 'text/plain',
      "responseText": JSON.stringify(PDFDocData)
    });  
    
    expect($("#docViewer").find("[data-pageindex]").size()).toBe(4);
    expect($("#docViewer .fwr-pages").size()).toBe(2);

    setTimeout(function() {       
      var request = jasmine.Ajax.requests.when("/pdfdata/doc_1/page_0_zoom_100_1").response({
        "status": 200,
        "contentType": 'text/plain',
        "responseText": "JSON.stringify(PDFDocData)"
      })
      done()
    }, 2000);
  });  
})
});